﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using System.Net;
using System.Net.Mail;

namespace SMSSnew.CLASSES
{
    public class mailsCLZ
    {
        public string adminEmail = "rpmchathu@gmail.com";
        public string adminPassword = "071895292141v";
        public string receiverEmail;
        public string subject;
        public string message;

        public bool SendMail(mailsCLZ objMail)
        {
            try
            {
                MailMessage msg = new MailMessage();
                msg.From = new MailAddress(objMail.adminEmail);
                msg.To.Add(objMail.receiverEmail);
                msg.Subject = objMail.subject;
                msg.Body = objMail.message;
                SmtpClient sc = new SmtpClient("smtp.gmail.com");
                sc.Port = 25;
                sc.Credentials = new NetworkCredential(objMail.adminEmail, objMail.adminPassword);
                sc.EnableSsl = true;
                sc.Send(msg);
             
                return true;
            }
            catch (Exception ex)
            {
                return false;           
            }
        }
    }
}
